﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CuitWinRadioButton.cs" company="">
//   
// </copyright>
// <summary>
//   The cuit win radio button.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace UITest.CUIT.CuitControls.WinControls
{
    using Microsoft.VisualStudio.TestTools.UITesting;
    using Microsoft.VisualStudio.TestTools.UITesting.WinControls;

    /// <summary>
    ///     The cuit win radio button.
    /// </summary>
    public class CuitWinRadioButton : CuitWinControl<WinRadioButton>
    {
        #region Constructors and Destructors

        /// <summary>
        ///     Initializes a new instance of the <see cref="CuitWinRadioButton" /> class.
        /// </summary>
        public CuitWinRadioButton()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitWinRadioButton"/> class.
        /// </summary>
        /// <param name="testControl">
        /// The test control.
        /// </param>
        public CuitWinRadioButton(UITestControl testControl)
            : base(testControl)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitWinRadioButton"/> class.
        /// </summary>
        /// <param name="testControl">
        /// The test control.
        /// </param>
        /// <param name="searchProperties">
        /// The search properties.
        /// </param>
        public CuitWinRadioButton(UITestControl testControl, string searchProperties)
            : base(testControl, searchProperties)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitWinRadioButton"/> class.
        /// </summary>
        /// <param name="testControl">
        /// The test control.
        /// </param>
        /// <param name="searchProperties">
        /// The search properties.
        /// </param>
        /// <param name="filterProperties">
        /// The filter properties.
        /// </param>
        public CuitWinRadioButton(UITestControl testControl, string searchProperties, string filterProperties)
            : base(testControl, searchProperties, filterProperties)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitWinRadioButton"/> class.
        /// </summary>
        /// <param name="wrappedControl">
        /// The wrapped control.
        /// </param>
        /// <param name="searchProperties">
        /// The search properties.
        /// </param>
        public CuitWinRadioButton(ICuitControlBase wrappedControl, string searchProperties)
            : base(wrappedControl, searchProperties)
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CuitWinRadioButton"/> class.
        /// </summary>
        /// <param name="wrappedControl">
        /// The wrapped control.
        /// </param>
        /// <param name="searchProperties">
        /// The search properties.
        /// </param>
        /// <param name="filterProperties">
        /// The filter properties.
        /// </param>
        public CuitWinRadioButton(ICuitControlBase wrappedControl, string searchProperties, string filterProperties)
            : base(wrappedControl, searchProperties, filterProperties)
        {
        }

        #endregion

        #region Public Properties

        /// <summary>
        ///     Gets the group.
        /// </summary>
        public UITestControl Group
        {
            get
            {
                return this._control.Group;
            }
        }

        /// <summary>
        ///     Gets the group as cui te.
        /// </summary>
        public CuitWinGroup GroupAsCUITe
        {
            get
            {
                var group = new CuitWinGroup();
                group.WrapReady(this._control.Group);
                return group;
            }
        }

        /// <summary>
        ///     Gets a value indicating whether is selected.
        /// </summary>
        public bool IsSelected
        {
            get
            {
                this._control.WaitForControlReady();
                return this._control.Selected;
            }
        }

        #endregion

        #region Public Methods and Operators

        /// <summary>
        ///     The select.
        /// </summary>
        public void Select()
        {
            this._control.WaitForControlReady();
            this._control.Selected = true;
            this.WriteTestOutput(string.Empty);
        }

        #endregion
    }
}